import { formatTimestamp } from '@/utils/format'
import { getTextByCode } from '../utils/getTextByCode'
import { formatMoney } from '@/utils/util'

export const BATCH_PAY_TYPE = {
  10: '线上支付',
  20: '线下支付'
}

export const BATCH_STATUS = {
  0: '待处理',
  1: '处理中',
  2: '已完成',
  [-9]: '异常'
}

export const BANK_STATUS = {
  0: '未上传',
  1: '已上传'
}

export const INVOICE_STATUS = {
  0: '未开票',
  1: '已申请',
  2: '已开票',
  9: '已驳回'
}
export const BATCH_LIST_COLUMNS = [
  {
    title: '订单ID',
    dataIndex: 'batchId'
  },
  {
    title: '项目名称',
    dataIndex: 'projectName'
  },
  {
    title: '企业名称',
    dataIndex: 'enterpriseName'
  },
  {
    title: '总笔数',
    dataIndex: 'personCount'
  },
  {
    title: '众包费',
    dataIndex: 'afterFee',
    customRender: afterFee => formatMoney(afterFee),
    customExportRender: afterFee => formatMoney(afterFee).substring(2)
  },
  {
    title: '服务费',
    dataIndex: 'manageFee',
    customRender: manageFee => formatMoney(manageFee),
    customExportRender: manageFee => formatMoney(manageFee).substring(2)

  },
  {
    title: '总费用',
    dataIndex: 'totalFee',
    customRender: totalFee => formatMoney(totalFee),
    customExportRender: totalFee => formatMoney(totalFee).substring(2)
  },
  {
    title: '支付方式',
    dataIndex: 'payType',
    customRender: type => getTextByCode(type, BATCH_PAY_TYPE)
  },
  {
    title: '批次状态',
    dataIndex: 'batchStatus',
    customRender: status => getTextByCode(status, BATCH_STATUS)
  },
  {
    title: '发票状态',
    dataIndex: 'invoiceStatus',
    customRender: status => getTextByCode(status, INVOICE_STATUS)
  },
  // {
  //   title: '是否有回单',
  //   dataIndex: 'bankVoucherStatus',
  //   customRender: status => getTextByCode(status, BANK_STATUS)
  // },
  // {
  //   title: '状态',
  //   dataIndex: 'settleStatus',
  //   customRender: status => getTextByCode(status, BATCH_STATUS)
  // },
  {
    title: '创建时间',
    dataIndex: 'createdDate',
    customRender: date => formatTimestamp(date)
  },
  {
    title: '支付时间',
    dataIndex: 'payTime'
  },
  {
    title: '操作',
    dataIndex: 'action',
    width: '260px',
    scopedSlots: { customRender: 'action' },
    fixed: 'right'
  }
]
